package com.polaris.live.ui.party.activity.base

import android.os.Bundle
import android.view.WindowManager
import androidx.viewbinding.ViewBinding
import com.polaris.live.common.mvvm.viewmodel.BaseViewModel
import com.polaris.live.ui.game.GameUtils
import com.polaris.live.ui.live.activity.base.BaseLiveActivity
import com.polaris.live.ui.party.listener.OnSpectatorFragmentListener
import com.polaris.live.ui.party.listener.RoomControlListener
import com.polaris.live.utils.zego.media.MediaProxy

/**
 * 语聊房观众base
 * @author Created by 天晴 on 2024/3/14 13:43
 * @since 1.0.0
 **/
abstract class BasePartySpectatorActivity<VM : BaseViewModel, VB : ViewBinding> :
    BaseLiveActivity<VM, VB>(), OnSpectatorFragmentListener, RoomControlListener, GameUtils.GameStateListener {

    override fun initView(savedInstanceState: Bundle?) {
        super.initView(savedInstanceState)
        window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
        GameUtils.addGameStateListener(this)
        MediaProxy.observeMediaPlayer(this)
    }

    override fun onDestroy() {
        super.onDestroy()
        GameUtils.removeGameStateListener(this)
    }
}